package com.kdzy.lshy.socity_server.common;

import java.io.Serializable;

/**
 * 获取异常详细信息
 * @author cly
 * @since 2018-06-21
 */
public class ExceptionDetailMessage {

    /**
     * 异常toString
     * @param e 异常类
     * @return 异常详细信息字符串
     */
    public static String getExceptionDetail(Exception e) {
        StringBuffer stringBuffer = new StringBuffer(e.toString() + "\n");
        StackTraceElement[] messages = e.getStackTrace();
        int length = messages.length;
        for (int i = 0; i < length; i++) {
            stringBuffer.append("\t"+messages[i].toString()+"\n");
        }
        return stringBuffer.toString();
    }

}
